package com.zjy.health_ms.entity;

import lombok.Data;

/**
 * @program: health_ms
 * @ClassName Result
 * @description: 统一返回结果
 * @author: Ats
 * @create: 2025-05-12 15:28
 * @Version 1.0
 */

@Data
public class Result {

    private static  final String SUCCESS_MASSAGE = "操作成功";
    private static  final String Fail_MASSAGE = "操作失败";

    private Boolean flag;
    private String massage;
    private Object data;


    public Result(Boolean flag, String massage){
        this.flag = flag;
        this.massage = massage;
    }
    public Result(Boolean flag, String massage, Object data){
        this.flag = flag;
        this.massage = massage;
        this.data = data;
    }

    public static Result buildSuccess(Boolean flag){
        return new Result(flag, SUCCESS_MASSAGE);

    }
    public static Result buildSuccess(Object data){
        return new Result(true, SUCCESS_MASSAGE, data);
    }

    public static Result buildFail(){
        return new Result(false, Fail_MASSAGE);
    }




}
